setProvince();
setOneClass(1);

function setProvince()
{
	Ts_areaInfo.getAreaClassByUpId('000000000000000',function(data){
		DWRUtil.removeAllOptions('province');
		DWRUtil.addOptions('province',{'':'请选择'});
		DWRUtil.addOptions('province',data);
	})
}
function setCitys(prov)
{
   var provence=prov;
	 Ts_areaInfo.getAreaClassByUpId(provence,function(data){
		DWRUtil.removeAllOptions('eparchy_code');
		DWRUtil.addOptions('eparchy_code',{'':'请选择'});
		DWRUtil.addOptions('eparchy_code',data);
		//DWRUtil.removeAllOptions('city_code');
		//DWRUtil.addOptions('city_code',{'':'请选择'});
	});
}

function setAreas(city_id){
	Ts_areaInfo.getAreaClassByUpId(city_id,function(data){
	 	DWRUtil.removeAllOptions('city_code');
     	DWRUtil.addOptions('city_code',{'':'请选择'});
	 	DWRUtil.addOptions('city_code',data);
	});
}





function setOneClass(val){
	Ts_categoryInfo.getCatClassByUpId("000000000000000",val,setSort1);
}
function setSort1(map_data)
{
	var factory = $("sort1");
	DWRUtil.removeAllOptions("sort1");
	DWRUtil.addOptions('sort1',{'':'请选择'});
	DWRUtil.addOptions("sort1",map_data);
}


  
  var type = "1";
// 设置二级分类
function setSecondClass(val) {
	var up_class_id = val; 
 
	Ts_categoryInfo.getCatClassByUpId(up_class_id, type, setSort2);
}
function setSort2(map_data) {
	DWRUtil.removeAllOptions("sort2");
	DWRUtil.addOptions("sort2", {'':'请选择'});
	DWRUtil.addOptions("sort2", map_data);
	//$("sort3").style.display = "none";
	var item = $("sort2").length;

}
// 设置三级分类
function setTherdClass(val) {
	var up_class_id = val;
	Ts_categoryInfo.getCatClassByUpId(up_class_id, type, setSort3);
}
function setSort3(map_data) {
	if (map_data != null) {
		DWRUtil.removeAllOptions("sort3");
		DWRUtil.addOptions("sort3", {'':'请选择'});
		DWRUtil.addOptions("sort3", map_data);
	}
}
 
function setTypeName1(obj){
	  var idx = obj.value;
		$("class_id3").value="";
		$("class_id2").value="";
		$("class_id1").value=idx;
		//Ts_categoryInfo.getCatNameById(idx,setClassName1);
		//$("class_name").value=DWRUtil.getText(obj.name);
		//$("count").value=obj.name;
}
function setClassName1(val) {
	$("name3").innerHTML = '';
	$("name2").innerHTML = '';
	$("name1").innerHTML = val;
	$("name0").innerHTML = '';
}

function setTypeName2(obj){
	  var idx = obj.value;
	  $("class_id3").value="";
		$("class_id2").value=idx;
		//Ts_categoryInfo.getCatNameById(idx,setClassName2);
		//$("class_name").value=DWRUtil.getText(obj.name);
		//$("count").value=obj.name;
}
function setClassName2(val) {
	$("name3").innerHTML = '';
	$("name2").innerHTML = " > "+val;
}
function setTypeName3(obj){
	  var idx = obj.value;
		$("class_id3").value=idx;
		//Ts_categoryInfo.getCatNameById(idx,setClassName3);
		//$("class_name").value=DWRUtil.getText(obj.name);
		//$("count").value=obj.name;
}
function setClassName3(val) {
	$("name3").innerHTML = " > "+val;
}

function ChangeClassStyle(){
	document.getElementById("class_attr").value = "";
	document.getElementById("flag_code").value = "1";
	document.getElementById("classId1").style.display="none";
	document.getElementById("classId2").style.display="";
}

 
 //验证只能输入数字和小数点
function clearNoNum(obj){
	//先把非数字的都替换掉，除了数字和.
	obj.value = obj.value.replace(/[^\d.]/g,"");
	//必须保证第一个为数字而不是.
	obj.value = obj.value.replace(/^\./g,"");
	//保证只有出现一个.而没有多个.
	obj.value = obj.value.replace(/\.{2,}/g,".");
	//保证.只出现一次，而不能出现两次以上
	obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
}
// 检测是否为合法数据
function isNum(str) {
	return (str.search(/^\d+(\.\d+)?$/) != -1);
}
function trim(str){
    return str.replace(/(^\s*)|(\s*$)/g,"");
  }//去掉空格


//========================提交验证========================
function  submitForm()
{
	  document.addForm.submit();

}



//========================用户名验证start ===========================







function ifCheck(){
	
	if(document.getElementById("client_status5").checked == true){
		
		document.getElementById("client_status1").disabled=true;
		document.getElementById("client_status2").disabled=true;
		document.getElementById("client_status3").disabled=true;
		document.getElementById("client_status4").disabled=true;
	}else {
		
		document.getElementById("client_status1").disabled=false;
		document.getElementById("client_status2").disabled=false;
		document.getElementById("client_status3").disabled=false;
		document.getElementById("client_status4").disabled=false;
	}
}



//验证主营方向
function showSpan(val){
	if(val==1){
		document.getElementById('xiaoshou').style.display='block';
		document.getElementById('caigou').style.display='none';
	}
	if(val==0){
		document.getElementById('xiaoshou').style.display='none';
		document.getElementById('caigou').style.display='block';
	}
	if(val==2){
		document.getElementById('xiaoshou').style.display='block';
		document.getElementById('caigou').style.display='block';
	}
}




function choseForm(val)
{
	if(val == "custButton"){
	document.getElementById('custInfo').style.display='';
	document.getElementById('userInfo').style.display='none';
	document.getElementById('levelInfo').style.display='none';
	}
	if(val == "userButton"){
	document.getElementById('custInfo').style.display='none';
	document.getElementById('userInfo').style.display='';
	document.getElementById('levelInfo').style.display='none';
	}
	if(val == "levelButton"){
	document.getElementById('custInfo').style.display='none';
	document.getElementById('userInfo').style.display='none';
	document.getElementById('levelInfo').style.display='';
	}	
}

 //-----------------------------


function ChangeOrg(){
	document.getElementById("org1").style.display = "none";
	document.getElementById("org2").style.display = "inline";
	//document.getElementById("org_id").value = "";
}
